package com.song.oscsong.adapter;

import java.util.List;

import com.song.oscsong.R;
import com.song.oscsong.bean.Tweet;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class TweetAdapter extends BaseAdapter{
	
	private List<Tweet> tweets;
	
	public TweetAdapter(List<Tweet> tweets) {
		super();
		this.tweets = tweets;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return tweets.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return tweets.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_cell, null);
		TextView title = (TextView) v.findViewById(R.id.tv_title);
		title.setText( tweets.get(position).getBody());
		return v;
	}

}
